package com.wl.mq;

import java.io.IOException;
import java.util.HashMap;

/**
 * Created by zhen on 2016/10/11.
 */
public class Main {

    public Main() throws IOException{

        QueueConsumer consumer = new QueueConsumer("queue");
        Thread consumerThread = new Thread(consumer);
        consumerThread.start();

        Producer producer = new Producer("queue");

        for (int i = 0; i < 1000; i++) {
            HashMap message = new HashMap();
            message.put("message number", i);
            producer.sendMessage(message);
            System.out.println("Message Number "+ i +" sent.");
        }
    }

    public static void main(String[] args) throws IOException{
        new Main();
    }
}
